﻿using System;
using System.Collections.Generic;

namespace OMC.DataManagement
{
    /// <summary>
    /// This class represents a folder of the outlook inbox.
    /// </summary>
    public class Folder
    {
        /// <summary>
        /// The Name of the Folder, its similar to the Folder in Outlook
        /// </summary>
        public string FolderName { get; set; }
        /// <summary>
        /// The folder path of the folder, it contains the whole folder path, similar to the path
        /// in outlook
        /// </summary>
        public string FolderInfo { get; set; }

        /// <summary>
        /// the extra info of the folder, like the entryID
        /// </summary>
        public string FolderExtra { get; set; }

        List<MailContent> mailList;

        /// <summary>
        /// The constructor.
        /// </summary>
        /// <param name="folderName">the name of the outlook mail folder</param>
        /// <param name="folderInfo">to determine the folder</param>
        /// <param name="folderExtra">extra info about the folder, like the entryID</param>
        public Folder(String folderName, String folderInfo, String folderExtra)
        {
            this.FolderName = folderName;
            this.FolderInfo = folderInfo;
            this.FolderExtra = folderExtra;
            mailList = new List<MailContent>();
        }

        /// <summary>
        /// This mehtod adds a mail item to the Maillist.
        /// </summary>
        /// <param name="body">The Body of the mail</param>
        /// <param name="subject">the subject of the mail</param>
        /// <param name="sender">the sender mail address of the mail</param>
        /// <param name="to">the receiver mail address of the mail</param>
        public void AddMailContent(String body, String subject, String sender, String to)
        {
            mailList.Add(new MailContent(body, subject, sender, to));
        }

        /// <summary>
        /// This enumerator gets the mailcontent of the items.
        /// </summary>
        /// <returns>elements</returns>
        public IEnumerator<MailContent> GetEnumerator()
        {
            foreach (MailContent mailContent in mailList)
            {
                yield return mailContent;
            }
        }
    }
}